public ArrCode
public ArrXCode
public ArrRsn
public ArrXRsn

Sub window_onload

'********************************************************************
' On Windows Load Check If it is a Return From The Validation Site	*
' and If The New Fund Check Box was selected.						*
' Generate The Fund Type and Xfer Type listboxes if " TRUE"			*	
'********************************************************************

If frmFormE.new.value="True" and frmFormE.fund.value="no" then 
	
	frmFormE.chkNewFund.checked=true
	dim strLst
	
END iF


'****************************************************************************
'The "GET" Value shows that it is the first Time that the Form is loaded	*
'The Fund Type list Box are generated										*
'The Directive Reason's default value are set								*
'****************************************************************************

iF frmFormE.new.value="GET" then
	frmFormE.lstRFD.selectedIndex = 2
	clearall(frmFormE)
	If frmFormE.fund.value = "no" then
		ClearFund(frmFormE)
		'frmFormE.chkNewFund.focus
	end If
End If

'****************************************
'	Check if this is a New fund			*
'****************************************

if frmFormE.fund.value = "no" then   'New Fund
	
Else 

end If

'********************************************************************
' Check for any return value from Xfer Y/N selected Index Value		*
'********************************************************************
if frmFormE.YN.VALUE = "1" then
	If frmFormE.fund.value = "Yes" then
		GetXferRsn()
	Else 
		
	End If
	frmFormE.txtfn.disabled = false
	frmFormE.txtnf.disabled = false
	frmFormE.txtat.disabled = false
	frmFormE.XFERnUMBER.disabled = false
	frmFormE.lstFTTrans.disabled = false
	frmFormE.lstFTTrans.selectedIndex = frmFormE.XferTypeIn.VALUE
else
	frmFormE.txtfn.disabled = true
	frmFormE.txtnf.disabled = true
	frmFormE.txtat.disabled = true
	frmFormE.XFERnUMBER.disabled = true
	frmFormE.lstFTTrans.disabled = true
end If
End Sub   'END OF WINDOW ON LOAD EVENT


'****************************************************************
' Set the SelectedIndex  Variable for Directive Reason on change *
'****************************************************************

sub lstRFD_onchange
	frmFormE.dirRsnIndex.value = frmFormE.lstRFD.selectedIndex
end Sub

'****************************************************************
' Set the SelectedIndex  Variable for Xfer Type Select			 *
'****************************************************************

SUB lstFTTrans_onchange
	frmFormE.XferTypeIn.value = frmFormE.lstFTTRans.selectedIndex
	
	if frmFormE.xferNumber.value <> "" then
		Call KeyTaxMessageBox ("Please note that you can enter either and existing fund number, or specify new transfer fund details." & vbcrlf & vbcrlf & "The existing transfer fund number that you have inserted, will therefore be cleared.", "Input Error", "Exclamation")
		'Msgbox "Please note that you can enter either and existing fund number, or specify new transfer fund details." & vbcrlf & vbcrlf & "The existing transfer fund number that you have inserted, will therefore be cleared."
		frmFormE.xferNumber.value = ""
	end if
	
end Sub

'*************************************************
' Set Xfer Drop down on return for existing Fund *
'*************************************************

function GetXferRsn()
		
END fUNCTION

'****************************************************
' On Submit Button set the Selected Index Varaibles	*
'****************************************************

Sub SubmitDirective_onclick
	frmFormE.XferTypeIn.value = frmFormE.lstFTTrans.selectedIndex
	frmFormE.DirRsnIndex.value = frmFormE.lstRFD.selectedIndex
End Sub

sub txtADFullDate_onfocus
	If frmFormE.focusset.value = "CDDaySet" then
		'frmFormE.txtCDFullDate.focus
		frmFormE.focusset.value = ""
	end If
end Sub

sub txtGLS_onfocus
	IF frmFormE.focusset.value = "ADDaySet" then
		'frmFormE.txtADFullDate.focus
		frmFormE.focusset.value = ""
	end If
end Sub

Sub OTC(FormName)
	
	If mid(FormName.txtOTC.value,1,1) <> "R" then
		If isnumeric(mid(FormName.txtOTC.value,1,1)) then
			FormName.txtOTC.value = "R" & FORMATNumber(FormName.txtOTC.value,2)
		ELSE
			FormName.txtOTC.value=""
		END iF
	end if
	
End Sub

SUB ClearAll(FormName)

	FormName.txtCDFullDate.VALUE	= ""
	FormName.txtCDMonth.VALUE		= ""
	FormName.txtCDDay.value			= ""
	FormName.txtCDYear.value		= ""
	FormName.txtCD.value			= ""
	FormName.txtADFullDate.VALUE	= ""
	FormName.txtADMonth.VALUE		= ""
	FormName.txtADDay.value			= ""
	FormName.txtADYear.value		= ""
	FormName.txtAD.value			= ""
	FormName.txtTPAS.value			= ""
	FormName.txtTY.value			= ""
	FormName.txtGLS.value			= ""
	FormName.txtTRA.value			= ""
	FormName.txtOTC.value			= ""
	FormName.lstYN.selectedindex	= 0
	FormName.txtNF.value			= ""
	FormName.txtFN.value			= ""
	FormName.txtAT.value			= ""
	FormName.txtPN.value			= ""
	FormName.xferNumber.VALUE		= ""
	
end Sub

Sub ClearFund(FormName)
	FormName.txtFundName.value		= ""
	FormName.txttelNumber.value		= ""
	FormName.txtTelCode.value		= ""
	FormName.txtPost1.value			= ""
	FormName.txtPost2.value			= ""
	FormName.txtPost3.VALUE			= ""
	FormName.txtPost4.VALUE			= ""
	FormName.txtPostCode.VALUE		= ""
	FormName.txtCP.VALUE			= ""
end Sub


Sub chkNewFundClick(FORMNAME)

End Sub

Sub NewFundChecked(FormName)
End Sub

Sub TRA(FormName)
	If mid(FormName.txtTRA.value,1,1) <> "R" then
		If isnumeric(mid(FormName.txtTRA.value,1,1)) then
			FormName.txtTRA.value = "R" & FORMATNumber(FormName.txtTRA.value,2)
		else
			FormName.txtTRA.value = ""
		END iF
	end if
End Sub

sub txtTRA_onfocus
	
end Sub

sub txtTPAS_onfocus
	
end Sub

sub txtOTC_onfocus
	
end Sub

sub txtPN_onfocus

end Sub

sub txtNF_onfocus
	
end Sub

sub txtFN_onfocus

end Sub

sub txtAT_onfocus

end Sub


sub xferNumber_onfocus

end Sub

sub txtFundName_onfocus

end Sub

sub txtCP_onfocus

end Sub

sub txtTelCode_onfocus

end Sub

sub txtTelNumber_onfocus

end Sub

sub txtPost1_onfocus

end Sub

sub txtPost2_onfocus

end Sub

sub txtPost3_onfocus

end Sub

sub txtPost4_onfocus

end Sub

sub txtPostCode_onfocus

end Sub

sub PeriodToYear_onfocus

end Sub

sub PeriodFromYear_onfocus

end Sub

Sub PeriodFromDay_onchange
	if LEN(frmFormE.periodFromDay.value) <> 2 THEN
		Call KeyTaxMessageBox ("The day you have entered, is not valid", "Input Error", "Exclamation")
		'MSGBOX "Invalid DAY"
	Else
		THEMONTH = frmFormE.PeriodFromMonth.value
		iF LEN(THEMONTH) = 2 Then
			strMM = GetMonth(THEMONTH)
			If strMM = "NotValid" then
				Call KeyTaxMessageBox ("The date you have entered, is not valid", "Input Error", "Exclamation")
				'Msgbox "Date Invalid."
			Else
				if len(frmFormE.PeriodFromDay.value)=2 and len(frmFormE.PeriodFromYear.value)=4 then
					NewDate = frmFormE.PeriodFromDay.value & " " &  strMM & " " & frmFormE.periodfromYear.value		
					If ISDATE(Newdate)=FALSE THEN
					
						Call KeyTaxMessageBox ("The date you have entered, is not valid", "Input Error", "Exclamation")
						'msgbox "Date Invalid"
						
					Else
						frmFormE.periodFrom.value = NewDate
					End If
				else
					Call KeyTaxMessageBox ("The month you have entered, is not valid", "Input Error", "Exclamation")
					'msgbox "Month Invalid"
				end If
			END iF
		Else
			Call KeyTaxMessageBox ("The month you have entered, is not valid", "Input Error", "Exclamation")
			'msgbox "Month Invalid"
		end If
	end If
End Sub

Sub PeriodToDay_onchange
	if LEN(frmFormE.periodToDay.value) <> 2 THEN
		Call KeyTaxMessageBox ("The day you have entered, is not valid", "Input Error", "Exclamation")
		'MSGBOX "Invalid DAY"
	Else
		THEMONTH = frmFormE.periodToMonth.value
		If len(THEMONTH) = 2 then
			strMM = GetMonth(THEMONTH)
			If strMM = "NotValid" then
				Call KeyTaxMessageBox ("The date you have entered, is not valid", "Input Error", "Exclamation")
				'Msgbox "Date Invalid."
			Else
				if len(frmFormE.PeriodToDay.value)=2 and len(frmFormE.PeriodToYear.value)=4 then
					NewDate = frmFormE.PeriodToDay.value & " " &  strMM & " " & frmFormE.periodToYear.value		
					If ISDATE(Newdate)=FALSE THEN
						Call KeyTaxMessageBox ("The date you have entered, is not valid", "Input Error", "Exclamation")
						'msgbox "Date Invalid"
					Else
						frmFormE.periodTo.value = NewDate
					End If
				else
					Call KeyTaxMessageBox ("The month you have entered, is not valid", "Input Error", "Exclamation")
					'msgbox "Month Invalid"
				end If
			END iF
		else
			Call KeyTaxMessageBox ("The month you have entered, is not valid", "Input Error", "Exclamation")
			'msgbox "Date Invalid"
		end If
	end If
End Sub

sub PeriodToYearClear(FormName)
	call numbersonly()
end Sub

sub PeriodToMonthClear(FormName)
	call numbersonly()
end Sub

sub PeriodToDayClear(FormName)
	call numbersonly()
end Sub

sub PeriodFromYearClear(FormName)
	call numbersonly()
end Sub

sub PeriodFromMonthClear(FormName)
	call numbersonly()
end Sub

sub PeriodFromDayClear(FormName)
	call numbersonly()
end Sub